package com.study.pattern.observer.usingjdk;

import java.util.Observable;
import java.util.Observer;

import com.study.pattern.observer.vo.Lady;
import com.study.pattern.observer.vo.LadyData;

public class LadyObserver implements Observer,Runnable{
	
	Observable cheerLeaderObservable;
	Lady lady = Lady.newInstance();

	private LadyObserver(){}
	
	@Override
	public void update(Observable observable, Object ladyData) {
		this.cheerLeaderObservable = observable;
		lady.update((LadyData)ladyData);
	}

	public static LadyObserver newInstance() {
		return new LadyObserver();
	}

	@Override
	public void run() {
		lady.chant();
	}
	
	public void destroyLady(){
		lady.terminate();
	}
}
